package com.coolpoint.test;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import com.tencent.tinker.lib.util.TinkerLog;
import com.tinkerpatch.sdk.TinkerPatch;
import com.tinkerpatch.sdk.server.callback.ConfigRequestCallback;

import java.util.HashMap;

public class MainActivity extends AppCompatActivity {

    private final String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TinkerPatch.with().fetchPatchUpdate(true);
        //test2();


        test();
    }


    private void test() {

        Log.e(TAG, "I am on onCreate classloader1:" + MainActivity.class.getClassLoader().toString());
        Log.e(TAG, "I am on onCreate string:" + getResources().getString(R.string.test_resource));

        SlideSignatureView slideLockView = (SlideSignatureView) findViewById(R.id.slide);
        slideLockView.setOnSlideListener(new SlideSignatureView.OnSlideListener() {
            @Override
            public void slideSuccess() {
                Toast.makeText(MainActivity.this, "滑倒终点", Toast.LENGTH_LONG).show();
            }
        });


    }


    private void test2() {
        TinkerPatch.with().fetchDynamicConfig(new ConfigRequestCallback() {

            @Override
            public void onSuccess(HashMap<String, String> configs) {
                TinkerLog.w(TAG, "request config success, config:" + configs);
            }

            @Override
            public void onFail(Exception e) {
                TinkerLog.w(TAG, "request config failed, exception:" + e);
            }
        }, true);
    }


}
